@extends('client/layoutIndex')

@section('link')
    <link rel="stylesheet" type="text/css" href="{{ asset('client/css/register.css') }}">
    {{--<script type="text/javascript" collectsrc="{{ asset('client/js/.js') }}"></script>--}}


    <script src="{{ asset('client/js/send.js') }}"></script>
@stop

@section('content')
        <div class="form">

            <div style="width:1200px;margin:auto;height:700px;">
                <div class="form-ggw">
                    <div class="ggw7"><img src="{{ asset('productImg/'.$ad4->picture) }}" width="180px" height="200px"></div>
                    <div class="ggw8"><img src="{{ asset('productImg/'.$ad5->picture) }}" width="180px" height="200px"></div>
                </div>
                <div class="form-login">
                    <div class="form-denglu">
                        <h3 style="font-weight:bold;">账号注册</h3>
                        <span></span>
                        <img src="{{ asset('client/image/xvxian.png') }}">
                    </div>
                    <script type="text/javascript">
                        function checkPhone(){
                            var phone = $('#phone').val();
                            if(!(/^1[34578]\d{9}$/.test(phone))){
                                $("#yphone").html("<font color='red'>请输入正确的电话号码</font>");
                                layer.msg('请输入正确的电话号码!');
                                $('#sub').attr('disabled',"true");
                                return false;
                            }
                        }
                        function cancel() {
                            $("#yphone").html("");
                            var _pwd = $("#ypwd").text();
                            if(_pwd == ""){
                                $('#sub').removeAttr('disabled');
                            }
                        }
                        function checkPwd(){
                            var pwd = $('#pw1').val();
                            var repwd = $('#pw2').val();
                            if(pwd != repwd){
                                $("#ypwd").html("<font color='red'>两次密码不相同</font>");
                                layer.msg('两次密码不相同!');
                                $('#sub').attr('disabled',"true");
                                return false;
                            }
                        }
                        function cancelPwd() {
                            $("#ypwd").html("");
                            var _p = $("#yphone").text();
                            if(_p == ""){
                                $('#sub').removeAttr('disabled');
                            }
                        }
                    </script>
                    <div id="signup-tel-form" method="post" class="form-form">
                        <form action="{{ url('client/register') }}" method="post" >
                            {{csrf_field()}}
                            <span id="msg" style="display: none;">
                                @if( !empty(Session::get('show_warning')))
                                    <div style="width: 100%;height: 30px;margin:0 auto;">
                                        <span style="color: red;display: block;text-align: center;font-size: 18px;line-height: 30px;">{{ Session::get('show_warning') }}</span>
                                    </div>
                                @elseif (count($errors) > 0)
                                    @foreach ($errors->all() as $error)
                                        <div style="width: 100%;height: 30px;">
                                            <span style="color: red;display: block; width: 400px;text-align: center;font-size: 20px;line-height: 30px;">{{ $error }}</span>
                                        </div>
                                    @endforeach
                                @endif
                            </span>
                            <script type="text/javascript">
                                var _msg = $('#msg div span').text();
                                if(_msg != ''){
                                    layer.msg(_msg);
                                }
                            </script>
                            {{--<div class="field">--}}
                                {{--<label>车牌号</label>--}}
                                {{--<input name="car_num" placeholder="车牌号" class="form-control" required="required"  id="car" >--}}
                            {{--</div>--}}
                            <div class="form-group" style="margin:30px;">
                                <label class="col-md-3 col-sm-5 col-xs-5">用户名:</label>
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <input type="text" name="car_num" placeholder="车牌号" class="form-control" required="required"  id="car" >
                                </div>
                                <div class="col-md-4 col-sm-2 col-xs-2">
                                    <span id="spName"></span>
                                </div>
                            </div><br />
                            <div class="form-group" style="margin:30px;">
                                <label class="col-md-3 col-sm-5 col-xs-5">手机号码：</label>
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <input type="text" name="phone" placeholder="手机号码" class="form-control" required="required"  id="phone" onblur="checkPhone()" onfocus="cancel()" maxlength="11">
                                </div>
                                <div class="col-md-4 col-sm-2 col-xs-2">
                                    <span id="spTel"></span>
                                </div>
                            </div><br />
                            <div class="form-group" style="margin:30px;">
                                <label class="col-md-3 col-sm-5 col-xs-5">验证码：</label>
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <input type="text" name="code" placeholder="收到的验证码" class="form-control">
                                </div>
                                <div class="col-md-4 col-sm-2 col-xs-2">
                                    <input type="button" id="btnreg" onclick="register();" class="btn btn-default" value="获取验证码" />
                                </div>
                            </div><br />
                            <div class="form-group" style="margin:30px;">
                                <label class="col-md-3 col-sm-5 col-xs-5">密码：</label>
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <input name="password" type="password" placeholder="设定登录密码" min="6" max="32" class="form-control" id="pw1"  required="required">
                                </div>
                                <div class="col-md-4 col-sm-2 col-xs-2">
                                    <span id="spPs1"></span>
                                </div>
                            </div><br />
                            <div class="form-group" style="margin:30px;">
                                <label class="col-md-3 col-sm-5 col-xs-5">确认密码：</label>
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <input type="password" name="password_confirmation"  min="6" max="32"  placeholder="请再输入一次登录密码" class="form-control" id="pw2"  onblur="checkPwd()" onfocus="cancelPwd()"  required="required">
                                </div>
                                <div class="col-md-4 col-sm-2 col-xs-2">
                                    <span id="spPs2"></span>
                                </div>
                            </div><br />
                            <span class="ts_span" id="ypwd" style="display: none;"></span>
                            <div class="form-group" style="margin:70px 30px;">
                                <div class="col-md-offset-4 col-md-6">
                                    <input id="sub" type="submit" value="注册" class="btn btn-danger denglu">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="form-ggw-1">
                    <div class="ggw9"><img src="{{ asset('productImg/'.$ad6->picture) }}" width="239px" height="310px"></div>
                </div>
            </div>
        </div>
@stop